import { KcpdMap } from "@/kcpd/maps";
import { createGameModule } from "@sapi-game/createGameModule";
import { GameContext } from "@sapi-game/gameContext";
import { TTLPlayer } from "@sapi-game/gamePlayer/gamePlayer";
import { PlayerGroup } from "@sapi-game/gamePlayer/playerGroup";

interface KcqdConfig {
    map: KcpdMap;
    roundTime: number;
}

export class KcqdContext extends GameContext {
    players: PlayerGroup<KcqdPlayer>;
    /**重生点 */
    config: KcqdConfig;

    get map() {
        return this.config.map;
    }

    constructor(players: PlayerGroup<KcqdPlayer>, config: KcqdConfig) {
        super();
        this.players = players;
        this.config = config;
    }
}

export class KcqdPlayer extends TTLPlayer {
    override initialTTL: number = 40;
    isSausage: boolean = false;
    win: boolean = false;
}

export const KcqdModule = createGameModule({
    contextClass: KcqdContext,
    playerClass: KcqdPlayer,
});
